# -*- coding:utf-8 -*-
from django.db import models

# Create your models here.

class PayOrder(models.Model):

    code = models.CharField(max_length=22, null=False, default='', unique=True)  # 订单号
    status = models.PositiveSmallIntegerField(null=False, default=0)  # 订单状态
    date_added = models.DateTimeField(null=True)  # 订单委托时间
    date_done = models.DateTimeField(null=True)  # 订单成交时间
    date_expire = models.DateTimeField(null=True)  # 订单到期日
    provider = models.CharField(max_length=20, null=False, default='')  # 支付平台
    provider_trade_id = models.CharField(max_length=50, null=True)  # 支付平台流水
    buyer_id = models.CharField(max_length=30, null=False, default='')  # 支付账号
    stb_id = models.CharField(max_length=64, null=False, default='')  # 支付设备
    subject = models.CharField(max_length=30, null=False, default='')  # 商品名称
    subject_id = models.CharField(max_length=4, null=False, default='W99')  # 商品代码
    subject_type = models.CharField(max_length=1, null=False, default='U')  # 商品类型
    price = models.IntegerField(null=False, default=0)  # 价格，单位分
    token = models.CharField(max_length=32, null=False, default='')  # 标识
    timestamp = models.BigIntegerField(null=False, default=0)  # 订单时间戳
    flavor = models.CharField(max_length=10, null=True)  # 订单渠道
    app_id = models.CharField(max_length=32, null=False, default='')  # app标识
    auto_renew = models.BooleanField(null=False, default=False)  # 是否自动续订
